package com.itheima.case2.dao;

import com.itheima.case2.pojo.po.User;
import com.itheima.case2.pojo.vo.AddUser;
import com.itheima.case2.pojo.vo.QueryPageBean;
import com.itheima.case2.pojo.vo.UpdateUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface UserMapper {

    List<User> findUserByPage(QueryPageBean bean);

    Long findUserTotal(QueryPageBean queryPageBean);

    void addUser(AddUser au);

    void addRoleByUid(@Param("uid") Integer uid, @Param("ids") List<String> roleIds);

    @Update("update t_user set username=#{username},password=#{password},email=#{email} where id = #{id}")
    void updateUser(UpdateUser uu);
    @Delete("delete from t_user_role where user_id = #{id}")
    void deleteRoleByUid(Integer id);

    @Delete("delete from t_user where id = #{uid}")
    void deleteUserById(int uid);
}
